package com.infindo.appcreate.zzyj.entity;

import static javax.persistence.GenerationType.SEQUENCE;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.infindo.appcreate.zzyj.util.DateTimeUtil;

@Entity
@Table(name = "zzyj_activity_talk", schema = "public")
public class ActivityTalk implements java.io.Serializable {

    private static final long serialVersionUID = -961556270368780758L;
    
    private Long id;
    private String actCode;
    private String expertCode;//public or expert code
    private String image;
    private String nickName;
    private Date time;
    private String desc;
    
    private String timeF;//format time item
    
    public ActivityTalk(){
        
    }
    
   public ActivityTalk(String actCode, String expertCode, String image, String nickName, Date time, String desc){
        super();
        this.actCode = actCode;
        this.expertCode = expertCode;
        this.image = image;
        this.nickName = nickName;
        this.time = time;
        this.desc = desc;
   }

	@SequenceGenerator(name = "generator", sequenceName = "seq_zzyj_activity_talk",allocationSize=1)
	@Id
	@GeneratedValue(strategy = SEQUENCE, generator = "generator")
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	
    @Column(name = "_desc")
    public String getDesc() {
        return desc;
    }
    public void setDesc(String desc) {
        this.desc = desc;
    }

    @Column(name = "time")
    public Date getTime() {
        return time;
    }
    public void setTime(Date time) {
        this.time = time;
    }

    @Column(name = "act_code")
    public String getActCode() {
        return actCode;
    }
    public void setActCode(String actCode) {
        this.actCode = actCode;
    }

    @Column(name = "image")
    public String getImage() {
        return image;
    }
    public void setImage(String image) {
        this.image = image;
    }

    @Column(name = "nickName")
    public String getNickName() {
        return nickName;
    }
    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    @Column(name = "expert_code")
    public String getExpertCode() {
        return expertCode;
    }
    public void setExpertCode(String expertCode) {
        this.expertCode = expertCode;
    }
    
    @Transient
  	public String getTimeF() {
      	if(null != this.time){
      		return DateTimeUtil.DateToString("yyyy.MM.dd hh:mm:ss", this.time);
      	}
  		return null;
  	}
  	public void setTimeF(String timeF) {
  		this.timeF = timeF;
  	}
	
}
